<?php


namespace Module\ScheduleManager\Admin\Controller;


use Illuminate\Routing\Controller;
use ModStart\Admin\Concern\HasAdminQuickCRUD;
use ModStart\Admin\Layout\AdminCRUDBuilder;
use ModStart\Grid\GridFilter;
use ModStart\Support\Concern\HasFields;

class JobController extends Controller
{
    use HasAdminQuickCRUD;

    protected function crud(AdminCRUDBuilder $builder)
    {
        $builder
            ->init('jobs')
            ->field(function ($builder) {
                /** @var HasFields $builder */
                $builder->id('id', 'ID');
                $builder->display('created_at', '创建时间');
                $builder->display('queue', '名称');
                $builder->display('attempts', '尝试次数');
                $builder->display('reserved', '是否锁定');
                $builder->display('reserved_at', '锁定时间');
                $builder->display('available_at', '可用时间');
                $builder->json('payload', 'Payload');
            })
            ->gridFilter(function (GridFilter $filter) {
                // $filter->eq('id', L('ID'));
            })
            ->title('队列调度')
            ->canDelete(false)->canAdd(false)->canEdit(false)->canShow(false);
    }
}
